# Author: Deepseek
# Date: 2025-03-27
# Purpose: Draw a chessboard image
from PIL import Image, ImageDraw


# 调整size参数可改变棋盘格数（默认8x8）
# 修改tile_size可调整每个格子像素大小
# 替换颜色值（如'black'改为'#333333'）可自定义配色
def draw_chessboard(size=13, tile_size=50):
    img = Image.new('RGB', (size * tile_size, size * tile_size), 'white')
    draw = ImageDraw.Draw(img)
    for row in range(size):
        for col in range(size):
            if (row + col) % 2 == 0:
                draw.rectangle([
                    col * tile_size, row * tile_size,
                    (col + 1) * tile_size, (row + 1) * tile_size
                ], fill='black')
    img.save('chessboard_hd.png')


draw_chessboard()
